# Use MySQL image
FROM mysql:8.0
# Set root password
ENV MYSQL_ROOT_PASSWORD=123456
# Create database
ENV MYSQL_DATABASE=campus_db
# Copy initialization script (will be executed automatically)
COPY database/init.sql /docker-entrypoint-initdb.d/
EXPOSE 3306
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
  CMD mysqladmin ping -h localhost -u root -p123456 || exit 1